<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" charset="UTF-8"
	src="../js/prefixfree.min.js"></script>
<link rel="stylesheet" type="text/css" href="../css/base.css"
	media="all" />
<link rel="stylesheet" type="text/css" href="../css/self.css"
	media="all" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="../viewport" content="width=device-width, initial-scale=1">
<link href="../css/bootstrap.css" rel="stylesheet">
<script src="../js/jquery-1.12.4.min.js"></script>
<script src="../js/bootstrap.js"></script>
</head>
<body>
	<h1>个人中心</h1>
	<div class="jumbotron">
		<form class="form-horizontal">
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">用户id</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" id="uid" value="${admin.uid }" readonly="readonly"
						placeholder="请输入账号">
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">用户名</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" id="uname" value="${admin.uname }"
						placeholder="请输入账号">
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">密码</label>
				<div class="col-sm-10">
					<input type="password" class="form-control" id="pwd" value="${admin.pwd }"
						placeholder="请输入密码">
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">重复密码</label>
				<div class="col-sm-10">
					<input type="password" class="form-control" id="repwd" value=""
						placeholder="请输入密码">
				</div>
			</div>
			<div class="form-group">
				<label for="inputEmail3" class="col-sm-2 control-label">电话</label>
				<div class="col-sm-10">
					<input type="text" class="form-control" id="tel" value="${admin.tel }"
						placeholder="请输入电话">
				</div>
			</div>
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" id="sub_btn" class="btn btn-danger">提&nbsp;&nbsp;交&nbsp;&nbsp;修&nbsp;&nbsp;改</button>
				</div>
			</div>
		</form>
	</div>
<script type="text/javascript">
	$("#sub_btn").click(function(){
		var uid = $("#uid").val();
		var uname = $("#uname").val();
		var pwd = $("#pwd").val();
		var repwd = $("#repwd").val();
		var tel = $("#tel").val();
		console.log(uid); 
		console.log(uname);
		console.log(pwd);
		console.log(tel);
		//let regexp="^((\(\d{3}\))|(\d{3}\-))?13[456789]\d{8}|15[89]\d{8}";
		//console.log(regexp.test(tel));
		
		if( uid=="" || uid==null || uname=="" || uname==null || pwd=="" || pwd==null || repwd=="" || repwd==null  || tel=="" || tel==null ){
			alert("请完善信息后提交!");
			if( repwd!=pwd ){
				alert("两次密码不一致!");
			}
		}else{
			$.post("../../admin_user",{
				op:'person_modify',
				uid:uid,
				uname:uname,
				pwd:pwd,
				tel:tel
			},function(data){
				if(data>0){
					alert("修改成功");
					top.location.reload();
				}else{
					alert('修改失败');
				}
			});
		}
	});
</script>
</body>